package server;

/**
 * @Description: 自定义 HttpServlet 抽象类
 * @Author jie.luo
 * @Create: 2020-06-23 22:49
 **/
public abstract class HttpServlet implements Servlet {

    public abstract void doGet(Request request, Response response);

    public abstract void doPost(Request request, Response response);

    @Override
    public void service(Request request, Response response) throws Exception {

        if ("GET".equalsIgnoreCase(request.getMethod())) {
            doGet(request, response);
        } else {
            doPost(request, response);
        }

    }
}
